$(function () {
  // console.log(123);

  // 热点图
  $.ajax({
    method: "GET",
    url: BigNew.index_hotpic,
    success: (res) => {
      console.log(res);
      const htmlStr = template("focusList", { list: res.data });
      $(".focus_list").html(htmlStr);
    },
  });
  $.ajax({
    type: "get",
    url: "http://localhost:8080/api/v1/admin/category/list",
    success: function (backData) {
      console.log(backData);
      $(".level_two").html(template("cat_list", backData));
    },
  });

  //3.最新咨询
  //ajax请求
  $.ajax({
    method: "GET",
    url: BigNew.index_latest,
    success: (res) => {
      // console.log(res);
      const htmlStr = template("cNewsList", { list: res.data });
      $(".common_news").html(htmlStr);
    },
  });

  //4.热门排行
  //ajax请求
  $.ajax({
    url: "http://localhost:8080/api/v1/index/rank",
    type: "get",
    dataType: "json",
    success: function (res) {
      console.log(res);
      const htmlStr = template("hotrankList", { list: res.data });
      $(".hotrank_list").html(htmlStr);
      $(".content_list").html(htmlStr);
    },
  });

  //5.最新评论
  $.ajax({
    method: "GET",
    url: BigNew.latest_comment,
    success: (res) => {
      // console.log(res);
      const htmlStr = template("commentList", { list: res.data });
      $(".comment_list").html(htmlStr);
    },
  });

  //6.焦点关注
  $.ajax({
    method: "GET",
    url: BigNew.attention,
    success: (res) => {
      console.log(res);
      const htmlStr = template("guanzhuList", { list: res.data });
      $(".guanzhu_list").html(htmlStr);
    },
  });
});
